package com.ec.edu.server;

import com.ec.edu.common.config.ApplicationContextProvider;
import com.ec.edu.server.hello.HelloNettyServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@Slf4j
@SpringBootApplication
@ComponentScan(basePackages = "com.ec.edu")
public class NettyServerApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(NettyServerApplication.class, args);
        ApplicationContextProvider.setApplicationContext(applicationContext);

        try {
            HelloNettyServer.start();
        } catch (InterruptedException e) {
            log.error("异常：", e);
        }
    }

}
